package Test;

import dao.InventoryDao;
import entity.*;
//import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import service.*;

import java.util.List;

public class ttt {
    private static ApplicationContext ac;
    static {
        ac = new ClassPathXmlApplicationContext("spring.xml");
    }
    public void c(){
        SupplierService s = (SupplierService) ac.getBean("supplierService");
        List<Supplier> a = s.list();
        for (Supplier q :a){
            System.out.println(q.getName());
        }
    }

    public void w(){
        WarehouseService s = (WarehouseService) ac.getBean("warehouseService");
        List<Warehouse> a = s.list();
        for (Warehouse q :a){
            System.out.println(q.getName());
        }
    }
    public void che(){
        LinService s = (LinService) ac.getBean("linService");
        List<Lin> a = s.list2();


        for (Lin q :a){
            System.out.println(q.getColor().getName());
        }
    }
    public void del(){
        LinService s = (LinService) ac.getBean("linService");
        int i = s.del(32);


        System.out.println(i);
    }

    public void cha(){
        StaffService s = (StaffService) ac.getBean("staffService");
        List<Staff> list = s.listjin();

        for (Staff s1:list){
            System.out.println(s1.getName());
        }


    }
    public void yan(){
        ColortypeService s = (ColortypeService) ac.getBean("colortypeService");
        List<Colortype> list = s.list();

        for (Colortype s1:list){
            System.out.println(s1.getName());
        }


    }
    public void query(){
        TransferService s = (TransferService) ac.getBean("transferService");
        List<Transfer> list = s.query();

        for (Transfer s1:list){
            System.out.println(s1.getOrdernumber());
        }


    }

    public void querytiaojian(){
        InventoryDao s = (InventoryDao) ac.getBean("inventoryDao");
        List<Inventory> list = s.querytiaojian("2018-06-01","2018-06-20","主仓库");

        for (Inventory s1:list){
            System.out.println(s1.getName());
        }


    }
    public static void main(String[] args) {
        ttt t = new ttt();
        t.querytiaojian();
    }
}
